swtich (error.constructor) {..}
instanceofの代わりに
code:ts
switch (error.constructor) {
case NotAllowedError:
return res.send(400);
case DatabaseEntryNotFoundError:
return res.send(404);
default:
log('Failed to do something async with an unspecified error: ', error);
return res.send(500);
}
https://stackoverflow.com/questions/36332665/how-to-use-instanceof-in-a-switch-statement